export function recurOptions(list:any,rootId:string) {
  function buildTree(node:any) {
	let children = []
	for (let item of list) {
	  if (item.parentId === node.id) {
		children.push(buildTree(item))
	  }
	}
	if (children.length > 0) {
	  node.children = children
	}
	return node
  }
  let res = []
  for (let item of list) {
	  if(rootId){
		if (item.parentId === rootId) {
		  res.push(buildTree(item))
		}  
	  }else{
		  if (item.parentId === '-1' || item.parentId === '') {
		    res.push(buildTree(item))
		  }
	  }
	
  }
  return res
}